<!--
Copyright (C) 2016-2023 Jones Magloire @Joxit

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<remove-registry-url>
  <material-popup opened="{ props.opened }" onClick="{ props.onClose }">
    <div class="material-popup-title">Remove your Registry Server ?</div>
    <div class="material-popup-content">
      <ul class="list">
        <li each="{ url in getRegistryServers() }">
          <span>
            <material-button
              onClick="{ remove(url) }"
              url="{ url }"
              text-color="var(--neutral-text)"
              color="inherit"
              waves-color="var(--hover-background)"
              waves-center="true"
              icon
            >
              <i class="material-icons">delete</i>
            </material-button>
            <span class="url">{ url }</span>
          </span>
        </li>
      </ul>
    </div>
    <div class="material-popup-action">
      <material-button
        class="dialog-button"
        waves-color="rgba(158,158,158,.4)"
        onClick="{ props.onClose }"
        color="inherit"
        text-color="var(--primary-text)"
      >
        Close
      </material-button>
    </div>
  </material-popup>
  <script>
    import { getRegistryServers, removeRegistryServers } from '../../scripts/utils';
    export default {
      remove(url) {
        return (event) => {
          removeRegistryServers(url);
          setTimeout(() => this.update(), 100);
        };
      },
      getRegistryServers,
    };
  </script>
  <style>
    :host material-popup .popup material-button {
      margin-right: 1em;
    }
  </style>
</remove-registry-url>
